package com.ruoyi.project.product.images.service;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.product.images.domain.Images;
import com.ruoyi.project.product.images.mapper.ImagesMapper;
import com.ruoyi.project.product.url.mapper.UrlMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ImagesServiceImpl implements IImagesService {

    @Autowired
    private ImagesMapper imagesMapper;


    /**
     * 图片查询
     * @param images
     * @return
     */
    @Override
    public List<Images> selectImagesList(Images images) {
        return imagesMapper.selectImagesList(images);
    }

    /**
     * 图片新增
     * @param images
     * @return
     */
    @Override
    public int insertImages(Images images) {
        return imagesMapper.insertImages(images);
    }

    /**
     * 根据id查询图片
     * @param imagesId
     * @return
     */
    @Override
    public Images selectImagesById(Long imagesId) {
        return imagesMapper.selectImagesById(imagesId);
    }

    /**
     * 图片修改
     * @param images
     * @return
     */
    @Override
    public int updateImages(Images images) {
        return imagesMapper.updateImages(images);
    }

    /**
     * 图片批量删除操作
     * @param ids
     * @return
     * @throws Exception
     */
    @Override
    public int deleteImagesByIds(String ids) throws Exception {
        return imagesMapper.deleteImagesByIds(Convert.toLongArray(ids));
    }

    /**
     * dom操作更改图片
     * @param images
     * @return
     */
    @Override
    public Images changeImagesUrl(Images images) {
        return imagesMapper.changeImagesUrl(images.getUrlId());
    }
}
